//
//  searchPsd.m
//  01-loginAndRegister
//
//  Created by panxubin on 16/8/30.
//  Copyright © 2016年 panxubin. All rights reserved.
//

#import "searchPsd.h"
#define MAS_SHORTHAND
#define MAS_SHORTHAND_GLOBALS
#import "Masonry.h"
#import "HMTextFiled.h"

@implementation searchPsd

-(void)viewDidLoad
{
   [self addtextFiled];

}

#pragma mark - 添加textFiled
-(void)addtextFiled
{
    UIColor *backColor = [UIColor colorWithRed:235 / 256.0 green:235 / 256.0 blue:235 / 256.0 alpha:1];
    self.view.backgroundColor = backColor;
    //     添加两个testFiled
    UITextField *userNaemeText = [[UITextField alloc]init];
    userNaemeText.text = @"+86|";
    userNaemeText.backgroundColor = [UIColor whiteColor];
    userNaemeText.borderStyle = UITextBorderStyleLine;
    
    UITextField *psdText = [[UITextField alloc]init];
    psdText.text = @"验证码：";
    psdText.backgroundColor = [UIColor whiteColor];
    psdText.borderStyle = UITextBorderStyleLine;
    
    [self.view addSubview:userNaemeText];
    [self.view addSubview:psdText];
    
    //    添加lable
    UILabel *lable = [[UILabel alloc]init];
    lable.text = @"登录和找回密码时，将使用此号码";
    lable.font = [UIFont systemFontOfSize:12];
    [self.view addSubview:lable];
    
    //    设置约束
    [userNaemeText makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view.left).offset(32);
        make.right.equalTo(self.view.right).offset(-32);
        make.height.offset(44);
        make.top.equalTo(self.view.top).offset(100);
    }];
    
    [lable makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self.view.left).offset(32);
        make.right.equalTo(self.view.right).offset(-32);
        make.top.equalTo(userNaemeText.bottom).offset(16);
        
    }];
    
    [psdText makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view.left).offset(32);
        make.right.equalTo(self.view.right).offset(-32);
        make.height.offset(44);
        make.top.equalTo(lable.bottom).offset(16);
    }];
    
    //    添加两个file到原先的textFile上
    //     添加两个testFiled
    HMTextFiled *psd = [[HMTextFiled alloc]init];
    psd.borderStyle = UITextBorderStyleNone;
    [psd becomeFirstResponder];
    psd.placeholder = @"输入手机接收到的验证码";
    
    HMTextFiled *userNaeme = [[HMTextFiled alloc]init];
    userNaeme.borderStyle = UITextBorderStyleNone;
    [userNaeme becomeFirstResponder];
    userNaeme.placeholder = @"请输入手机号";
    
    [userNaemeText addSubview:userNaeme];
    [psdText addSubview:psd];
    
    //    添加约束
    [userNaeme makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(userNaemeText.left).offset(44);
        make.right.equalTo(userNaemeText.right).offset(0);
        make.height.offset(44);
        make.top.equalTo(userNaemeText.top).offset(0);
    }];
    
    [psd makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(psdText.left).offset(64);
        make.right.equalTo(psdText.right).offset(0);
        make.height.offset(44);
        make.top.equalTo(psdText.top).offset(0);
    }];
    
    //    添加按钮
    UIButton *getCode = [[UIButton alloc]init];
    [getCode setTitle:@"获取验证码" forState:UIControlStateNormal];
    [getCode setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    getCode.titleLabel.font  =[UIFont systemFontOfSize:13];
    getCode.backgroundColor = backColor;
    [userNaeme addSubview:getCode];
    
    [getCode makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(userNaeme.right).offset(-4);
        make.height.offset(30);
        make.top.equalTo(userNaeme.top).offset(8);
    }];
    
    //    添加按钮
    UIButton *nextBtn = [[UIButton alloc]init];
    [nextBtn setBackgroundColor:[UIColor redColor]];
    [nextBtn setTitle:@"下一步" forState:UIControlStateNormal];
    nextBtn.titleLabel.font = [UIFont systemFontOfSize:20];
    [self.view addSubview:nextBtn];
    
    [nextBtn makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view.left).offset(32);
        make.right.equalTo(self.view.right).offset(-32);
        make.height.offset(44);
        make.top.equalTo(psd.bottom).offset(16);
    }];
    
}
    



@end
